﻿using System;
using CustomerContactSystem.Core.Infrastructure.Domain;

namespace CustomerContactSystem.Core.Model {
    public class EnquiryHistory : Entity {
        public virtual Enquiry Enquiry { get; set; }
        public virtual DateTime EventDate { get; set; }
        public virtual string EventDetail { get; set; }

        protected override void Validate() {
            if (Enquiry == null) {
                AddBrokenRule(new BusinessRule("Enquiry", "Enquiry is required!"));
            }

            if (EventDate == DateTime.MinValue) {
                AddBrokenRule(new BusinessRule("EventDate", "Event date is required!"));
            }

            if (string.IsNullOrEmpty(EventDetail)) {
                AddBrokenRule(new BusinessRule("EventDetail", "Event detail is required!"));
            }
        }
    }
}